package com.alibaba.citrus.ots.platform.enhance.sdo;

import lombok.Getter;
import lombok.Setter;

import java.util.Arrays;

/**
 * @author zhoubc
 * @description: TODO
 * @date 2021/9/13 13:55
 */
public enum OrganizationRelevanceTypeEnum {

    SCITEMGROUP(1, "货品组"),

    CHANNEL(2,"渠道");

    @Getter
    @Setter
    private int code;

    @Getter
    @Setter
    private String desc;

    OrganizationRelevanceTypeEnum(int code, String desc) {
        this.code = code;
        this.desc = desc;
    }

    public static OrganizationRelevanceTypeEnum of(Integer code) {
        if (code == null) {
            return null;
        }
        return Arrays.stream(OrganizationRelevanceTypeEnum.values()).filter(source -> code == source.code).findFirst().orElse(null);
    }

}
